
	<head>
	</head>
	<body style="margin:0px">
      <!--K线图-->
    <div id="myChart" style=" position:relative;height: auto; width: 100%; margin: 0px auto;">
    </div>
    <script type="text/javascript" src="../_Resource/line/jquery.min.js"></script> 
<script type="text/javascript" src="../_Resource/line/echarts.min.js"></script> 
<script type="text/javascript" src="../_Resource/line/kChart.js"></script> 
<script type="text/javascript">
	
	
	//	ChartControl.initUrl = "ajax.php?type=getKchart"; //初始化页面的Base URL 参数不用带
		//ChartControl.realTimeUrl = "ajax.php?type=getNewData"; //实时获取数据的URL
		//ChartControl.init();
		
	</script> 
<script type="text/javascript">$("#myChart").height($(window).height()-35);
        //获取数据              
        //图表下方K线图类型切换事件
		
		 var myChart = echarts.init(document.getElementById('myChart'));
        
var interval=1*60;
var tpid=1;
var MI='MA';
var VI='MACD';
var setTimeoutTime=null;
var setShiShiTimeoutTime=null;
var loadUrl="jiekou/getList.php?symbolId=002004&periodId=1";
var shishiUrl="jiekou/getMinuteList.php";
//loadUrl="http://api.huobi.com/staticmarket/ticker_btc_json.js";
shishiUrl="";
var firstLoad=true;
function initFun(){
	
	firstLoad=true
	myChart.showLoading()
	loadDataFun()
	
}

function tmFun(tm){
	var yy=tm.substr(0,4)
	var MM=tm.substr(4,2)
	var dd=tm.substr(6,2)
	var hh=tm.substr(8,2)
	var mm=tm.substr(10,2)
	var ss=tm.substr(12,2)
	//var date=new Date(yy,MM,dd,hh,mm,ss)
	//return(date)
	return(yy+'-'+MM+'-'+dd+' '+hh+':'+mm+':'+ss)
}
function loadShiShiDataFun()
{
	if(setShiShiTimeoutTime!=null)
        {
	       clearTimeout( setShiShiTimeoutTime);
         }
		 
	$.ajax({  
        type: "get",
		url:shishiUrl,
        dataType:'json',       
        success: function(data) {
		updataShiShiChartFun(data)
	   setShiShiTimeoutTime =setTimeout(function () 
	   {
           loadShiShiDataFun()
         }, 2*1000);
		}
		})
			
}
function loadDataFun()
{
	//加载数据
	if(setTimeoutTime!=null)
        {
	       clearTimeout( setTimeoutTime );
         }
		 if(setShiShiTimeoutTime!=null)
        {
	       clearTimeout( setShiShiTimeoutTime);
         }
		 
	$.ajax({  
        type: "post",
		url:loadUrl,
       
        //data:{'pz':''},
        dataType:'json',       
        success: function(data) {
          //j加载成功

		  if (chartType!="k2"|| (chartType=="shishi" && firstLoad==true))
		  {
			  var dateList=[]
			  var numList=[]
			  var vol=[]
			  var coArr=[]
			  var shishi=[]
			  for (var s = 0, len = data.length; s < len; s++) {
				 
				  dateList[s]=tmFun(data[s][0])
				  //console.log(data);
				  //debugger;
				  numList[s]=[data[s][1],data[s][4],data[s][3],data[s][2]]
				  //console.log(numList[s]);
				  //	document.write("["+numList[s]+"],");
				   vol[s]=data[s][5]
				   if(data[s][1]<data[s][4]){
				     coArr[s]='#FD1050'
				   }else{
					 coArr[s]='#0CF49B'  
				   }
				   shishi[s]=data[s][4]
			  };
			   var newData={dateList:dateList,numList:numList,vol:vol,coArr:coArr}
			  if(chartType!="k"){
			 newData.shishi=shishi
			 setShiShiTimeoutTime =setTimeout(function () 
	   {
           loadShiShiDataFun()
         }, 2*1000);
			  }
		      if(firstLoad==true){
			    myChart.hideLoading();
			    createKChartFun(newData)
			    firstLoad=false
		      }else{
			    updataKChartFun(newData)
		      }
		  }else{
			 
		  }
		  
			 
//////////////////////////
        
        setTimeoutTime =setTimeout(function () 
	   {
           loadDataFun()
       }, interval*1000);
	}
	})
}//end

function resizeFun(hei){
	$("#myChart").height(hei);
}

		parent.initFun()
    </script>
</body>
